import json

from django.db import models


# Create your models here.
class ContrabandImage(models.Model):
    item_id = models.BigAutoField(primary_key=True)
    time = models.BigIntegerField(verbose_name='检测时间')
    place = models.CharField(verbose_name='检测地点', max_length=100)
    name = models.CharField(verbose_name='违禁品名称', max_length=100)
    original_img_path = models.CharField(verbose_name='原始图像保存路径', max_length=100)
    detected_img_path = models.CharField(verbose_name='检测图像保存路径', max_length=100)

    class Meta:
        db_table = 'contraband_image'
        verbose_name = '违禁品'

    def __str__(self):
        info = {"item_id": self.item_id,
                "time": self.time,
                "place": self.place,
                "name": self.name,
                "original_img_path": self.original_img_path,
                "detected_img_path": self.detected_img_path}
        return str(info)
